package com.ft.f_springboot_route.mapper;


import com.ft.f_springboot_route.bean.Banner;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface BannerMapper {


    public List<Banner> selectBannerAll(Integer routeId, Integer currentPage);

    public Long selectBannerTotal(Integer routeId);

    @Select("select banner.*,route.title from banner join route on banner.route_id=route.route_id where ban_id=#{banId}")
    public Banner selectBannerById(Integer banId);

    @Select("select * from banner where route_id=#{routeId}")
    public List<Banner> selectBannerByRouteId(Integer routeId);

    @Insert("insert into banner values(0,#{banSrc},#{isShow},#{routeId})")
    public void addBanner(Banner banner);

    @Update("update banner set ban_src=#{banSrc},is_show=#{isShow},route_id=#{routeId} where ban_id=#{banId}")
    public void editBannerById(Banner banner);

    @Delete("delete from banner where ban_id=#{banId}")
    public void deleteBannerById(Integer banId);

    @Delete("delete from banner where route_id=#{routeId}")
    public void deleteBannerByRouteId(Integer routeId);
}
